using System;
using System.Collections.Generic;

namespace MikeKappel.Com.CS
{
    public static partial class Helper
    {
        /// <summary>
        /// Generic TryParse Method
        /// ideal for teting an Interface
        /// </summary>
        /// <typeparam name="T">User defined generic type</typeparam>
        /// <param name="Arg">Original object</param>
        /// <param name="result">Output original object reference as user defined generic type.</param>
        /// <returns>Determines if Original object is the user defined generic type specified.</returns>
        public static Boolean TryParse<T>(Object Arg, out T result)
        {
            Boolean isType = (Arg is T);
            result = (T)((isType) ? Arg : default(T));
            return isType;
        }
    }
}